import { connect } from 'react-redux'
// import { ADD } from '../store/types'
import { addAction, minusAction } from '../store/countReducer/actions'
function Child(props) {
  let { count, dispatch } = props;
  const add = () => {
    dispatch(addAction(20))
  }
  const minus = () => {
    dispatch(minusAction(5))
    // setTimeout(() => {
    //   dispatch(minusAction(5))
    // }, 2000);
  }
  return <>
    <h1>{count}</h1>
    <button onClick={add}>+</button>
    <button onClick={minus}>-</button>
  </>
}
Child = connect((state) => {
  return {
    count: state.countReducer.count
  }
}, (dispatch) => {
  return {
    dispatch
  }
})(Child)
export default Child